import platform = require("../../../../../platform/common/baseCommon");
import appClient = require("../../../../../platform/client/appClient");
import platformControls = require("../../../../../platform/client/controls");
import echartControls = require("../../../../../platform/client/echartControls");
import report = require("../../../../../platform/client/report");
// 数据服务
let dataService1 = new appClient.asyncFactory(platform.IDataService, "remoteCall", "tzrjbtzAnalysysDataService");

// 数据获取器
/** 获取器:投资人投资行业类型分布 */
let fetcher_tzrtzhylxfb = new report.dataServiceFetcher();
fetcher_tzrtzhylxfb.name = "投资人投资行业类型分布";
fetcher_tzrtzhylxfb.command = "cmd_fsgs_tzr_tzhylx";
fetcher_tzrtzhylxfb.dataService = dataService1;
/** 获取器:投资人行业分布 */
let fetcher_tzrnlfb = new report.dataServiceFetcher();
fetcher_tzrnlfb.name = "投资人年龄分布";
fetcher_tzrnlfb.command = "cmd_fsgs_tzr_nl";
fetcher_tzrnlfb.dataService = dataService1;
/** 获取器: 投资人来源省份分布*/
let fetcher_tzrlysffb = new report.dataServiceFetcher();
fetcher_tzrlysffb.name = "投资人来源省份分布";
fetcher_tzrlysffb.command = "cmd_fsgs_tzr_lysf";
fetcher_tzrlysffb.dataService = dataService1;
/** 获取器: 投资人姓氏占比*/
let fetcher_tzrxszb = new report.dataServiceFetcher();
fetcher_tzrxszb.name = "投资人姓氏占比";
fetcher_tzrxszb.command = "cmd_fsgs_tzr_xszb";
fetcher_tzrxszb.dataService = dataService1;


// 数据源

/** 数据源:投资人投资行业类型分布 */
let dataSource_tzrtzhylxfb = new platform.dataQuerySource();
dataSource_tzrtzhylxfb.name = "data_gssjfx_tzrtzhylxfb";
dataSource_tzrtzhylxfb.fetcher = fetcher_tzrtzhylxfb;
/** 数据源:投资人行业分布*/
let dataSource_tzrnlfb = new platform.dataQuerySource();
dataSource_tzrnlfb.name = "data_gssjfx_tzrnlfb";
dataSource_tzrnlfb.fetcher = fetcher_tzrnlfb;
/** 数据源:投资人来源省份分布 */
let dataSource_tzrlysffb = new platform.dataQuerySource();
dataSource_tzrlysffb.name = "data_tzrfx_tzrlysffb";
dataSource_tzrlysffb.fetcher = fetcher_tzrlysffb;
/** 数据源:投资人姓氏占比 */
let dataSource_tzrxszb = new platform.dataQuerySource();
dataSource_tzrxszb.name = "data_tzrfx_tzrxszb";
dataSource_tzrxszb.fetcher = fetcher_tzrxszb;

/** 数据显示器: 投资人投资行业类型分布*/
let tableReport_tzrtzhylxfb = new report.echartsDataDisplayer();
tableReport_tzrtzhylxfb.name = "report_gssjfx_tzrtzhylxfb";
tableReport_tzrtzhylxfb.caption = "投资人投资行业类型分布";

tableReport_tzrtzhylxfb.dataViews = {};
let tableView_tzrtzhylxfb = new platform.dataView();
tableView_tzrtzhylxfb.dataSourceName = "data_gssjfx_tzrtzhylxfb";
tableReport_tzrtzhylxfb.dataViews["view_table"] = tableView_tzrtzhylxfb;

//柱状图
let axisSerie_tzrtzhylxfb = new echartControls.axisSerie();
//取数据库字段
let tzrtzhylxfb_field_num = new platform.dataField();
tzrtzhylxfb_field_num.name = "NUM";
tzrtzhylxfb_field_num.caption = "企业数量";
let tzrtzhylxfb_field_hylx = new platform.dataField();
tzrtzhylxfb_field_hylx.name = "NAME";
tzrtzhylxfb_field_hylx.caption = "行业类型";
//图配置
axisSerie_tzrtzhylxfb.xAxis = {
    type: "category",
    axises: [{
        caption: "行业类型",
        position: "buttom",
        color: "white",
    }]
};
axisSerie_tzrtzhylxfb.yAxis = {
    type: "value",
    axises: [{
        caption: "企业数量（单位：个）",
        nameLocation: "middle",
        nameGap: 55,
        color: "white",

    }]
};
axisSerie_tzrtzhylxfb.categoryFields = [{
    field: tzrtzhylxfb_field_hylx,
    index: 0
}];
axisSerie_tzrtzhylxfb.valueFields = [{
    type: "bar",
    field: tzrtzhylxfb_field_num,
    xAxisIndex: 0,
    yAxisIndex: 0,
    itemStyle: {
        normal: {
            color: "#8968CD"
        }
    }
}];
axisSerie_tzrtzhylxfb.currentGrid = {
    y2: 120
};
axisSerie_tzrtzhylxfb.italic = true;
tableReport_tzrtzhylxfb.echartObject = axisSerie_tzrtzhylxfb;

/** 数据显示器: 投资人年龄分布*/
let tableReport_tzrnlfb = new report.echartsDataDisplayer();
tableReport_tzrnlfb.name = "report_gssjfx_tzrnlfb";
tableReport_tzrnlfb.caption = "投资人年龄分布";

tableReport_tzrnlfb.dataViews = {};
let tableView_tzrnlfb = new platform.dataView();
tableView_tzrnlfb.dataSourceName = "data_gssjfx_tzrnlfb";
tableReport_tzrnlfb.dataViews["view_table"] = tableView_tzrnlfb;
//柱状图
let axisSerie_tzrnlfb = new echartControls.axisSerie();
//取数据库字段
let tzrnlfb_field_num = new platform.dataField();
tzrnlfb_field_num.name = "NUM";
tzrnlfb_field_num.caption = "投资人数量";
let tzrnlfb_field_nlfb = new platform.dataField();
tzrnlfb_field_nlfb.name = "NAME";
tzrnlfb_field_nlfb.caption = "投资人年龄";
//图配置
axisSerie_tzrnlfb.xAxis = {
    type: "category",
    axises: [{
        caption: "投资人年龄",
        position: "buttom",
        color: "white",
    }]
};
axisSerie_tzrnlfb.yAxis = {
    type: "value",
    axises: [{
        caption: "投资人数量（单位：个）",
        nameLocation: "middle",
        nameGap: 55,
        color: "white",
    }]
};
axisSerie_tzrnlfb.categoryFields = [{
    field: tzrnlfb_field_nlfb,
    index: 0
}];
axisSerie_tzrnlfb.valueFields = [{
    type: "bar",
    field: tzrnlfb_field_num,
    xAxisIndex: 0,
    yAxisIndex: 0,
    itemStyle: {
        normal: {
            color: "#EE7600"
        }
    }

}];
axisSerie_tzrnlfb.currentGrid = {
    x: 70,
    x2: 75
};

axisSerie_tzrnlfb.italic = true;
tableReport_tzrnlfb.echartObject = axisSerie_tzrnlfb;

/** 数据显示器:投资人来源省份分布 */
let tableReport_tzrlysffb = new report.echartsDataDisplayer();
tableReport_tzrlysffb.name = "report_tzrfx_tzrlysffb";
tableReport_tzrlysffb.caption = "投资人来源省份分布";
tableReport_tzrlysffb.dataViews = {};

let tableView_tzrlysffb = new platform.dataView();
tableView_tzrlysffb.dataSourceName = "data_tzrfx_tzrlysffb";
tableReport_tzrlysffb.dataViews["view_table"] = tableView_tzrlysffb;

let rowPieSerie1 = new echartControls.rowPieSerie();
//取数据库字段
let testfield_num = new platform.dataField();
testfield_num.name = "NUM";
testfield_num.caption = "数量";
let testfield_lysf = new platform.dataField();
testfield_lysf.name = "NAME";
testfield_lysf.caption = "来源省份";
//图配置
rowPieSerie1.categoryField = {
    field: testfield_lysf
};
rowPieSerie1.valueField = {
    field: testfield_num
};
rowPieSerie1.startAngle = 240;
tableReport_tzrlysffb.echartObject = rowPieSerie1;

/** 数据显示器: 投资人姓氏占比*/
let tableReport_tzrxszb = new report.echartsDataDisplayer();
tableReport_tzrxszb.name = "report_tzrfx_tzrxszb";
tableReport_tzrxszb.caption = "投资人姓氏占比";
tableReport_tzrxszb.dataViews = {};

let tableView_tzrxszb = new platform.dataView();
tableView_tzrxszb.dataSourceName = "data_tzrfx_tzrxszb";
tableReport_tzrxszb.dataViews["view_table"] = tableView_tzrxszb;
let rowPieSerie2 = new echartControls.rowPieSerie();
//取数据库字段
let field_tzrxszb_num = new platform.dataField();
field_tzrxszb_num.name = "NUM";
field_tzrxszb_num.caption = "数量";
let field_tzrxs = new platform.dataField();
field_tzrxs.name = "NAME";
field_tzrxs.caption = "投资人姓氏";
//图配置
rowPieSerie2.categoryField = {
    field: field_tzrxs
};
rowPieSerie2.valueField = {
    field: field_tzrxszb_num
};
rowPieSerie2.startAngle = 160;
tableReport_tzrxszb.echartObject = rowPieSerie2;



/* 佛山国税智能报表
* @description 佛山投资人基本特征分析
*/
exports.defaultObject = new report.smartReport();
exports.defaultObject.caption = "佛山投资人基本特征分析";
exports.defaultObject.dataSources = {};
exports.defaultObject.dataSources[dataSource_tzrlysffb.name] = dataSource_tzrlysffb;
exports.defaultObject.dataSources[dataSource_tzrxszb.name] = dataSource_tzrxszb;
exports.defaultObject.dataSources[dataSource_tzrtzhylxfb.name] = dataSource_tzrtzhylxfb;
exports.defaultObject.dataSources[dataSource_tzrnlfb.name] = dataSource_tzrnlfb;

exports.defaultObject.layoutPanel = new platformControls.layoutPanel("project/dataAnalysis/gsDataAnalysis/config/client/layout/layout2.html");
exports.defaultObject.modules = {};
exports.defaultObject.modules[tableReport_tzrtzhylxfb.name] = tableReport_tzrtzhylxfb;
exports.defaultObject.modules[tableReport_tzrnlfb.name] = tableReport_tzrnlfb;
exports.defaultObject.modules[tableReport_tzrlysffb.name] = tableReport_tzrlysffb;
exports.defaultObject.modules[tableReport_tzrxszb.name] = tableReport_tzrxszb;
exports.defaultObject.autoQuery = true;
